cmake_minimum_required(VERSION 2.8)

project(libj2x)

aux_source_directory(. SOURCES)
include_directories(${J2X_INC_DIR})

set(HEADERS j2x.h)

if(MSVC)
    add_definitions(-DJ2X_EXPORTS)
endif()

if(BUILD_SHARED_LIBS)
    add_library(j2x SHARED ${SOURCES} ${HEADERS})
    install(TARGETS j2x DESTINATION lib)
endif()

if(BUILD_STATIC_LIBS)
    add_library(j2x_static STATIC ${SOURCES} ${HEADERS})
    set_target_properties(j2x_static PROPERTIES OUTPUT_NAME "j2x")
    install(TARGETS j2x_static DESTINATION lib)
endif()

install(FILES ${HEADERS} DESTINATION include)
